package com.app.designpattern.structural.facade;

/**
 * USER: zjw
 * DATA: 2019/4/15 0015
 * TIME: 上午 10:13
 */
public class GoodsChangeService {
    //直接实现
    private QualifyService qualifyService = new QualifyService();
    private PointPaymentService pointPaymentService = new PointPaymentService();
    private ShippingService shippingService = new ShippingService();

   /* public void setQualifyService(QualifyService qualifyService) {
        this.qualifyService = qualifyService;
    }

    public void setPointPaymentService(PointPaymentService pointPaymentService) {
        this.pointPaymentService = pointPaymentService;
    }

    public void setShippingService(ShippingService shippingService) {
        this.shippingService = shippingService;
    }*/

    public void goodsChang(PointGood pointGood){
        //首先检验是否合格(是否有库存)
        if (qualifyService.isAvailable(pointGood)){
            //进行支付,支付成功获取物流信息
            if (pointPaymentService.Pay(pointGood)){
                //直接输出订单号,处理其他逻辑
                shippingService.shipGood(pointGood);

            }
        }
    }
}
